/*************************************************************************
> File Name: test_03.cpp
> Author: hzy
> Created Time: 2023-08-15 19:08:22
> Description: 虚析构函数
************************************************************************/
#include <iostream>

using namespace std;

class Base
{
private:
    /* data */
public:
    Base();
    virtual ~Base();
};

Base::Base()
{
    cout << "Base()" << endl;
}

Base::~Base()
{
    cout << "~Base()" << endl;
}

class Son : public Base
{
private:
    /* data */
public:
    Son(/* args */);
    ~Son();
};

Son::Son(/* args */)
{
    cout << "Son()" << endl;
}

Son::~Son()
{
    cout << "~Son()" << endl;
}

int main()
{
    Base *p = new Son;

    delete p;

    return 0;
}